package fuck;

import java.lang.reflect.Field;

public class Test1 {
    public static void main(String[] args) throws Exception {
        Class clazz = Class.forName("fuck.Student");

        // method1(clazz);
        // method2(clazz);
        //method3(clazz);
        Field field = clazz.getDeclaredField("name");
        System.out.println(field);

    }

    private static void method3(Class clazz) throws NoSuchFieldException {
        Field field = clazz.getField("age");
        System.out.println(field);
    }

    private static void method2(Class clazz) {
        Field[] fields1 = clazz.getDeclaredFields();
        for (Field field : fields1) {
            System.out.println(field);
        }
    }

    private static void method1(Class clazz) {
        Field[] fields = clazz.getFields();
        for (Field field : fields) {
            System.out.println(field);
        }
    }
}
